<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
<%
	request.setAttribute("title","安卓APK更新");
	request.setAttribute("modelConfigPath", "version");
%>
<%@ include file="/WEB-INF/views/shared/master/contentHeader.jsp"%>
<style type="text/css">
	.labelshow{padding:7px 5px 8px 5px !important;}
</style>
<t:panel cssClass="panel-flat form-detailed" customBody="true" customHead="true">
    <div class="detailed-navbar-content panel-body">
        <t:form modelAttribute="androidVersion" action="/version/androidVersion/save" method="post" cssClass="form-horizontal">
            <div class="hide">
                <t:hidden path="versionId"/>
                <t:hidden path="deleteMark"/>
            </div>
            <t:formgroup>
                <t:label path="versionNumber" cssClass="col-sm-2 col-xs-2 labelshow" />
                <t:input path="versionNumber" colClass="col-sm-10 col-xs-10" />
            </t:formgroup>
            <t:formgroup>
                <t:label path="versionCode" cssClass="col-sm-2 col-xs-2 labelshow" />
                <t:input path="versionCode" colClass="col-sm-10 col-xs-10" />
            </t:formgroup>
            <t:formgroup>
                <t:label path="fileId" cssClass="col-sm-2 col-xs-2 labelshow" />
                <t:hidden path="fileId" readonly="true" onclick="startUpload()" colClass="col-sm-10 col-xs-10" />
                <c:if test="${androidVersion.fileId !=null && androidVersion.fileId !='' }">
                	<t:button id="uploaded" style="margin-left:10px;padding-left:10px;fond-size:800;" onclick="startUpload()">已上传</t:button>
                </c:if>
                <c:if test="${androidVersion.fileId ==null || androidVersion.fileId =='' }">
               		<t:button id="uploaded" style="margin-left:10px;padding-left:10px;fond-size:800;" onclick="startUpload()">上传</t:button>
                </c:if>
            </t:formgroup>    
            <t:formgroup>
                <t:label path="description" cssClass="col-sm-2 col-xs-2 labelshow" />
                <t:textarea path="description" style="height:83px;"  colClass="col-sm-10 col-xs-10" />
            </t:formgroup>
        </t:form>
    </div>
    <t:panelFoot headingBtnCssClass="heading-btn pull-right-important">
		<t:button icon="icon-floppy-disk" onclick="saveData()" laddaType="progress" cssClass="btn-info" csize="sm">保存</t:button>		  
	</t:panelFoot>
</t:panel>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/uploaders/uploaders.jsp"%>
<script type="text/javascript">
function saveData(lBtn){
	if (!$("form:first").valid()){
		return;
	}
	lBtn.start();
	$("form:first").submit();
	
}	



function startUpload(){
	$("#uploaded").uploadFile({multi_selection:false,FileUploaded:function(up, file, info){
		if(info.status==200){
			var responseJson=JSON.parse(info.response);
			if(responseJson.status=="ok"){
				$.topNotify("上传成功","success");
				$("#fileId").val(responseJson.id);
				$("#upload").text("已上传");
		 	}else{
				$.topNotify("上传失败","error");
				return;
		 	}
		}	
	}
	});

}

</script>
<%@ include file="/WEB-INF/views/shared/scripts/uploadFile.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/jqueryui.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/notifications.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/forminputs.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formbuttons.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formstyling.jsp"%>
<%@ include file="/WEB-INF/views/shared/master/dialog.jsp"%>
<%@ include file="/WEB-INF/views/shared/master/contentFooter.jsp"%>